package io;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class AioServer {

    private int port;

    public AioServer(int port) {
        this.port = port;
    }

    public void start() throws IOException {
        ServerSocket serverSocket = new ServerSocket(port);
        while (true){
            Socket socket = serverSocket.accept();
            InputStream inputStream = socket.getInputStream();
            byte[] bytes = new byte[10];
            int n =0;
            while ((n=inputStream.read(bytes,0,bytes.length))>-1){
                System.out.println(new String(bytes));
                bytes = new byte[10];
            }

        }
    }
}
